<%@ page contentType="text/html; charset=utf-8" %>
<%@ include file="/WEB-INF/jsp/com/include/declare.jspf" %>
<%@ include file="/WEB-INF/jsp/com/include/doctype.jspf" %>

<script type="text/javascript">
<!--
    $(document).ready(function(){    
        var carcode = $("#carcode").val(); 
        
        if(carcode){
            if(carcode.length == 5){
                openCar(carcode.substring(0,2), carcode);
                
                var hidecont = $(".car-tab").find('.on-view'),
                hideparent = $(".car-tab").find('.on-anc');
                hidecont.removeClass('on-view').hide();
                hideparent.removeClass('on-anc');
                
                $(".car-tab").find("a").each(function (){
                    if($(this).attr("onclick").indexOf(carcode.substring(0,2))>0){
                        $(this).parent().addClass('on-anc');
                        $($(this).attr('href')).addClass('on-view').show(); 
                    }
                }); 
                
               
            }else{
                openCar( 'RD' , carcode );
            }
        }else{
            openCar( 'RD' , carcode );
        }
        
        pub4.updateCar();
        
        $('select.select1').customSelect();
        
        $('#hb_wn').attr("readonly", "readonly");
 
    });
    
    
    //차량목록
    function openCar( obj, carcode ){
        var obj = obj;
        $("#opcode").val(obj);
        
        if ( obj == 'HD' ){
            $("#HanDiCap").show();
        }else if ( obj != 'HD' ){
            $("#HanDiCap").hide();
            $("#HanDiCap").parent().hide();
        }
        
        if( obj == 'RN' ){
            $("#HanDiCap").hide();
            $("#HanDiCap").parent().hide();
            $("#hicvalue").val("D");
        }

        if( obj == 'RD' || obj == 'RV' ){
            $("#snsview").css("display", "block");
        }else{
            $("#snsview").css("display", "none");
        }
        
        var param = "carcodeclcd="+obj;
        $.ajax({
            type:'POST',
            url:'selectEstComCarMini.do' ,
            data:param,
            dataType:'html',
            cache:false,
            //error:function(){
            //   alert("데이터를 가져오지 못하였습니다."); 
            //},
            success:function ( html, status ){
                
                $("#"+obj).empty();
                
                reboot();
                
                $("#"+obj).html(html);
                
                setTimeout(function(){
                    if(carcode){
                        $("#"+obj).find("img").each(function (){
                            if($(this).attr("onclick").indexOf(carcode)>0){
                                //$(this).click();
                                eval($(this).attr("onclick")); 
                            }
                        });
                    }
                }, 1000);
            }
        });
    }

    function reboot(){
        $("#Grade").html("");
        $("#DGrade").html("");
        /*
        $("#TColor").html("");
        $("#IColor").html("");
        
        $("#tmIn").html("");
        
        $('#optionIn').html("");
        $('#TuixArea').html("");
        */
        $('#txtCarName').html("");
        $("#txtCarfnm").html("");
        $("#txtGrade").html("");
        $("#txtGradeDetail").html("");
        $("#txtTotalPrice").html("");
        $("#txtCarbasicprice").html("");
        $('#txtCarclrnm').html("");
        $('#txtCaroptnm').html("");
        $('#txtCaroptprice').html("");
        $('#txtCarsalenm').html("");
        $('#txtCarsaleprice').html("");
        $('#txtCarctrnm').html("");
        $('#txtCnsgprice').html("");
        
        /*
        $("#dcntNm").val("");
        $("#dcntAmt").val("0");
        $("#cuEtcPrice").val("0");
        $("#dcntsNm").val("");
        $("#dcntsAmt").val("0");
        $('#cnsgFee').val("0");
        $('#hb_wn').val("");
        */     
        $("#m2").attr("class","");
        $("#m3").attr("class","");
        $("#m4").attr("class","");
        $("#m5").attr("class","");
        $("#txtCarclrnm").html("");
        $("#txtCarclrprice").html("");
        $("#txtCarclrnm").html("");
        $("#txtCarclrprice").html("");
        
        $("#step1").css("display","none");
        $("#step2").css("display","none");
        $("#step3").css("display","none");
        $("#step4").css("display","none");
        $("#step5").css("display","none");
        $("#step6").css("display","none");
        $("#step7").css("display","none");
        
        $('#Tarea').css("display","none");
        
    }
    
    //차량선택
    function selectCar( code,  carn, section , partYn ){
        
        reboot();
        
        //INSERT
        $('#carcode').val(code);
        $('#carname').val(carn);
        $('#partYn').val(partYn);
        
        $('#car_name').val(carn);
        $('#car_code').val(code); //+"001"
        
        pub4.updateCar();
        
        $('#carArea > div > span > div > div').attr('class','');
        $('#'+section).attr('class','on');
        /*
        $('#section > div').each(function(){
            $('#section > div:eq('+ section +')').attr('class','on');
        });
        */
        
        //VIEW
        $('#txtCarName').html(carn);
        $("#txtCarfnm").html(carn);
        $("#txtGrade").parent().hide();
        
        openGrade( code );
        $('#DGrade').html("");
        
        //장애인/그랜저일때 면세정보 변경
        if($('#carcode').val() == 'HD004'){
            $("#TAX01").hide();
            $("#TAX02").show();
        }else{
            $("#TAX01").show();
            $("#TAX02").hide();
        }
    }
    
    //차량선택
    function selectImg( imgPath ){        
        //VIEW
        $('#selectCarImg').attr('src', '/kr/file/imagePathView.do?nrFilNm=trcarimage/'+ imgPath);
        $('#imagepath').val('/kr/file/imagePathView.do?nrFilNm=trcarimage/'+ imgPath);
    }
    
    //등급
    function openGrade( obj ){
        var carcode = obj;
        
        $.ajax({
            type:'POST',
            url:'selectEstComCarGrd.do' ,
            data:'carcode='+carcode,
            dataType:'html',
            cache:false,
            error:function(){
               alert("데이터를 가져오지 못하였습니다."); 
            },
            success:function ( html, status ){
                $('#Grade').html(html);
            }
        });
        
        dcsMultiTrack('DCS.dcssip','www.hyundai.com','DCS.dcsurl','/kr/estimation/estimationgeneral.do','WT.ti','홈_견적_견적내기_차량선택','WT.si_n','Hyundai_Estimate','WT.si_x','1');
    }
    
    //상세등급 ( DGrade )
    function openDGrade( obj, gradeC, gradeN ){
        var carcode = obj;
        var gradecode = gradeC;
        var gradename = gradeN;
        
        //INSERT
        $("#gradecode").val(gradecode);
        $("#gradename").val(gradename);
        
        //VIEW
        $("#txtGrade").html(gradename);
        $("#txtGrade").parent().show();
        
        var param = "carcode="+carcode+"&gradecode="+gradecode;
        $.ajax({
            type:'POST',
            url:'selectEstComCarGrdDetail.do' ,
            data:param,
            dataType:'html',
            cache:false,
            error:function(){
               alert("데이터를 가져오지 못하였습니다."); 
            },
            success:function ( html, status ){
                $('#DGrade').html(html);
            }
        });
    }

    //상세등급 선택
    function selectDGrade( vehlMdlCd, trimcode, tmcode, cntrCd, setCd, basicPrice , trimname  ){
        //INSERT
        $('#vehlMdlCd').val(vehlMdlCd);
        $("#trimcode").val(trimcode);
        $('#tm').val(tmcode);
        $('#cntrCd').val(cntrCd); 
        $("#setCd").val(setCd);
        $("#basicPrice").val(basicPrice);
        $("#gradeDname").val(trimname);
        //VIEW
        $("#txtGradeDetail").html(trimname);
        $("#txtTotalPrice").html(fnNumberFormat(basicPrice));
        $("#txtCarbasicprice").html(fnNumberFormat(basicPrice));
        
        $("#tempPrice").val(basicPrice);
        
        $("#step1").css("display","block");
        $("#step2").css("display","block");
        
        var carcode = $("#carcode").val();
        var gradeC = $("#gradecode").val();

        dcsMultiTrack('DCS.dcssip','www.hyundai.com','DCS.dcsurl','/kr/estimation/selectEstComCarGrdDetail.do','WT.ti','홈_견적_견적내기_상세등급선택','WT.si_n','Hyundai_Estimate','WT.si_x','2');
        openTColor( carcode, gradeC, trimcode );
        
    }
    
    //외장색상 ( TColor )
    function openTColor(obj, gradeC, trimcode){
        
        var carcode = obj;
        var gradecode = gradeC;
        var trimcode = trimcode;
        
        appendMETA('WT.ti','색상선택');
        //dcsMultiTrack('DCS.dcssip','www.hyundai.com','DCS.dcsurl','/kr/estimation/selectEstComCarTColor.do','WT.ti','홈_견적_견적내기_색상선택');
        dcsMultiTrack('DCS.dcssip','www.hyundai.com','DCS.dcsurl','/kr/estimation/selectEstComCarTColor.do','WT.ti','홈_견적_견적내기_외장색상선택','WT.si_n','Hyundai_Estimate','WT.si_x','3');
        
        var param = "carcode="+carcode+"&gradecode="+gradecode+"&trimcode="+trimcode;

        $.ajax({
            type:'POST',
            url:'selectEstComCarTColor.do' ,
            data:param,
            dataType:'html',
            cache:false,
            error:function(){
               alert("데이터를 가져오지 못하였습니다."); 
            },
            success:function ( html, status ){
                $('#TColor').html("");
                $('#IColor').html("");
                $('#TColor').html(html);
            }
        });
    }  
    
    //내장색상
    function openIColor( colorname, price, colorcode , carImgCode ){
        //INSERT
        var carcode = $("#carcode").val();
        var gradecode = $("#gradecode").val();
        var trimcode = $("#trimcode").val();
        
        var carImgCode = carImgCode;
        //차량 이미지 변경
        selectImg( carImgCode );
                
        //외장색상 선택
        $("#nTcolorname").val(colorname);
        $("#nTcolorprice").val(price);      
        $("#nTcolorcode").val(colorcode);
        
        //VIEW
        $("#m2").attr("class","on");
        $("#txtCarclrnm").html(colorname);
        $("#txtCarclrprice").html(fnNumberFormat(price));
        
        $("#tempTrColorPrice").val(price);  
        $("#txtTotalPrice").html("");
        $("#txtTotalPrice").html( fnNumberFormat( parseInt( $("#tempPrice").val() ) + parseInt( price ) ) );
        
        var outcolor = colorcode;
        
        dcsMultiTrack('DCS.dcssip','www.hyundai.com','DCS.dcsurl','/kr/estimation/selectEstComCarTColor.do','WT.ti','홈_견적_견적내기_내장색상선택','WT.si_n','Hyundai_Estimate','WT.si_x','4');
        
        var param = "carcode="+carcode+"&gradecode="+gradecode+"&trimcode="+trimcode+"&outcolor="+outcolor;
        $.ajax({
            type:'POST',
            url:'selectEstComCarIColor.do' ,
            data:param,
            dataType:'html',
            cache:false,
            error:function(){
               alert("데이터를 가져오지 못하였습니다."); 
            },
            success:function ( html, status ){
                $('#IColor').html(html);
            }
        });
    }      
    
    //내장색상 선택 후, 변속기 로드
    function selectIcolorList( colorname, price, colorcode ){
        //form 담고, 변속기 Select
        // trimcode / vehlMdlCd / setCd
        var carcode = $("#carcode").val();
        var gradecode = $("#gradecode").val();
        var trimcode = $("#trimcode").val();
        var setCd = $("#setCd").val();
        var vehlMdlCd = $("#vehlMdlCd").val();
        var tm = $('#tm').val();
        var basicPrice = $('#basicPrice').val();
        
        //내장색상 선택 INSERT
        $("#nIcolorname").val(colorname);
        $("#nIcolorprice").val(price);      
        $("#nIcolorcode").val(colorcode);
        
        //VIEW
        $("#txtCarclrnm").html( $("#nTcolorname").val() +" / "+ colorname);
        var oprice = $("#nTcolorprice").val();
        var rprice = parseInt(oprice) + parseInt(price);
        $("#txtCarclrprice").html(fnNumberFormat(rprice));
        
        $("#tempInColorPrice").val(price);
        $("#txtTotalPrice").html("");
        $("#txtTotalPrice").html( fnNumberFormat( parseInt( $("#tempPrice").val() ) + parseInt( $("#tempTrColorPrice").val() ) + parseInt( $("#tempInColorPrice").val() ) ) );
        
        var param = "trimcode="+trimcode+"&setCd="+setCd+"&vehlMdlCd="+vehlMdlCd+"&tm="+tm+"&basicPrice="+basicPrice;
        $.ajax({
            type:'POST',
            url:'selectEstComCarTM.do' ,
            data:param,
            dataType:'html',
            cache:false,
            error:function(){
               alert("데이터를 가져오지 못하였습니다."); 
            },
            success:function ( html, status ){
                $('#tmIn').html(html);
            }
        });
        
        $("#step3").css("display","block");
        $("#step4").css("display","block");
        
    }
    
    //변속기 선택후 차종키 및 옵션 로드
    function selectTM( nvehlMdlCd , tmcode , tm , price ){
        
        dcsMultiTrack('DCS.dcssip','www.hyundai.com','DCS.dcsurl','/kr/estimation/selectEstComCarTM.do','WT.ti','홈_견적_견적내기_변속기선택','WT.si_n','Hyundai_Estimate','WT.si_x','5');

        var tmcode = tmcode;
        var tm = tm;
        var price = price;
                
        //미션에 따른 판매코드 재 설정
        $('#vehlMdlCd').val( nvehlMdlCd  );
        $('#tmcode').val( tmcode );
        $('#tm').val( tm );
        $('#tmprice').val( price );
        
        $("#tempTmPrice").val(price);
        $("#txtTotalPrice").html("");
        var temp = parseInt( $("#tempPrice").val() ) + parseInt( $("#tempTrColorPrice").val() ) + parseInt( $("#tempInColorPrice").val() );
        
        $("#txtTotalPrice").html( fnNumberFormat( parseInt( temp ) +  parseInt( $("#tempTmPrice").val() ) ) );
        
        var carcode = $('#carcode').val();
        var vehlMdlCd = $('#vehlMdlCd').val();
        var setCd = $('#setCd').val();
        
        var param = "carcode="+carcode+"&setCd="+setCd+"&vehlMdlCd="+vehlMdlCd;
        $.ajax({
            type:'POST',
            url:'selectEstComCarOPN.do' ,
            data:param,
            dataType:'html',
            cache:false,
            error:function(){
               alert("데이터를 가져오지 못하였습니다."); 
            },
            success:function ( html, status ){
                $('#optionIn').html(html);
            }
        });
        
    }
    
    //옵션 저장 및 Tuix 로드 및 계산 준비.!!!
    function selectOpt( optnCd, optnItemNm, optionPrice ){
        
        //INSERT
        $('#optnCd').val( optnCd );
        $('#optnItemNm').val( optnItemNm );
        $('#optPrice').val( optionPrice );
        
        //VIEW
        $("#m3").attr("class","on");
        $('#txtCaroptnm').html( optnItemNm );
        $('#txtCaroptprice').html( fnNumberFormat(optionPrice) );
        
        $("#tempOptPrice").val(optionPrice);
        $("#txtTotalPrice").html("");
        var temp = parseInt( $("#tempPrice").val() ) + parseInt( $("#tempTrColorPrice").val() ) + parseInt( $("#tempInColorPrice").val() ) + parseInt( $("#tempTmPrice").val() );
        $("#txtTotalPrice").html( fnNumberFormat( parseInt( temp ) + parseInt( $("#tempOptPrice").val() ) ) );        
        
        var carcode = $('#carcode').val();
        var gradecode = $('#gradecode').val();
        var trimcode = $('#trimcode').val();
        var tmcode = $('#tmcode').val();
        var setCd = $('#setCd').val();
        var optnCd = $('#optnCd').val();
        var colorTr = $('#nTcolorcode').val();
        var colorIn = $('#nIcolorcode').val();
        
        $("#step5").show();
        $("#step6").show();
        
        if ( $('#partYn').val() == "Y"){
        
            var param = "carcode="+carcode+"&gradecode="+gradecode+"&trimcode="+trimcode+"&tmcode="+tmcode+"&setCd="+setCd+"&optnCd="+optnCd+"&colorTr="+colorTr+"&colorIn="+colorIn;
            //alert(param);
            $.ajax({
                type:'POST',
                url:'selectEstComCarTUIX.do' ,
                data:param,
                dataType:'html',
                cache:false,
                error:function(){
                   alert("데이터를 가져오지 못하였습니다."); 
                },
                success:function ( html, status ){
                    $('#TuixArea').html(html);
                }
            });
        
        }

        appendMETA('WT.ti','옵션선택');
        //dcsMultiTrack('DCS.dcssip','www.hyundai.com','DCS.dcsurl','/kr/estimation/selectEstComCarOPN.do','WT.ti','홈_견적_견적내기_옵션선택');
        dcsMultiTrack('DCS.dcssip','www.hyundai.com','DCS.dcsurl','/kr/estimation/selectEstComCarOPN.do','WT.ti','홈_견적_견적내기_옵션선택','WT.si_n','Hyundai_Estimate','WT.si_x','6');
        startPrice();
    }
    
    //트윅스 선택 
    function selectTuix( partsCd, partsNm, price ){
        //INSERT
        $('#partsCd').val( partsCd );
        $('#partsNm').val( partsNm );
        $('#partsprice').val( price );
        
        //VIEW
        var reoptnm = $('#optnItemNm').val() +" / "+ partsNm;
        var reoptprice = $('#optPrice').val();
        var rprice = parseInt(reoptprice)+parseInt(price);
        $('#txtCaroptnm').html( reoptnm );
        $('#txtCaroptprice').html( fnNumberFormat(rprice) );
        
        dcsMultiTrack('DCS.dcssip','www.hyundai.com','DCS.dcsurl','/kr/estimation/selectEstComCarTUIX.do','WT.ti','홈_견적_견적내기_TUIX선택','WT.si_n','Hyundai_Estimate','WT.si_x','7');
        
        if ( partsCd != "" && price != "" ){
            
        $("#tempTuixPrice").val(price);
        $("#txtTotalPrice").html("");
        var temp = parseInt( $("#tempPrice").val() ) + parseInt( $("#tempTrColorPrice").val() ) + parseInt( $("#tempInColorPrice").val() ) + parseInt( $("#tempTmPrice").val() ) + parseInt( $("#tempOptPrice").val() );
        $("#txtTotalPrice").html( fnNumberFormat( parseInt( temp ) + parseInt( $("#tempTuixPrice").val() ) ) );      
            
        }
        
    }
    
    //판매조건
    function startPrice(){
        
        //파라미터 세팅
        $("#m4").attr("class","on");
        $("#m5").attr("class","on");
        
        //호출 부분
        $('#step7').css("display","block");
        
        $('#saleList').html("");
        
        var param = "vehlMdlCd="+$("#vehlMdlCd").val();
        
        //판매조건
        $.ajax({
            type:'POST',
            url:'selectEstComCarSaleCnd.do' ,
            data:param,
            dataType:'html',
            cache:false,
            error:function(){
               alert("데이터를 가져오지 못하였습니다."); 
            },
            success:function ( html, status ){
                $('#saleList').html(html);
            }
        });
        
       
        //탁송료
        //판매코드/wdrgcd/
        $.post("selectReceiveList.do",
                {
            
                },
                function(data){
                    var ctsList = [];
                    var items = $(data).find("item");
                    var ite = items.size();
                    items.each(function(index,element){
                        var object={};
                        var wdrgCd = $(this).find("value").eq(0).text();
                        var wdrgNm = $(this).find("value").eq(1).text();
                        object["code"] = wdrgCd;
                        object["name"] = wdrgNm;
                        ctsList[index] = object;
                    });
                    if(ctsList.length > 0){
                        $('#ctsList').find("option").remove();
                        $('#ctsList').append('<option value="">시/도</option>');
                        for ( var i = 0 ; i < ctsList.length ; i++ ){
                            $('#ctsList').append('<option value="'+ctsList[i]["code"]+'" >'+ctsList[i]["name"]+'</option>');
                        }
                    }else{
                        $('#ctsList').find("option").remove();
                        $('#ctsList').append('<option value="">시/도</option>');
                    }
                }
        ); 
        //ctszoneList
        
        //등록비용 -selectEstComCarUPrice
        $.ajax({
            type:'POST',
            url:'selectEstComCarUPrice.do' ,
            data:param,
            dataType:'html',
            cache:false,
            error:function(){
               alert("데이터를 가져오지 못하였습니다."); 
            },
            success:function ( html, status ){
                $('#uprList').html(html);
            }
        });
        
        appendMETA('WT.ti','구매방법선택');
        //dcsMultiTrack('DCS.dcssip','www.hyundai.com','DCS.dcsurl','/kr/estimation/selectEstComCarSaleCnd.do','WT.ti','홈_견적_견적내기_구매방법선택');
        dcsMultiTrack('DCS.dcssip','www.hyundai.com','DCS.dcsurl','/kr/estimation/selectEstComCarSaleCnd.do','WT.ti','홈_견적_견적내기_구매방법선택','WT.si_n','Hyundai_Estimate','WT.si_x','8');
    }
    
    //판매조건 처리 - 세이브포인트 
    function saleOpen( nobnm, nobpr ){
      //dcntNm / dcntAmt
        var obnm = nobnm;
        var obpr = (parseInt(nobpr)*10000*0.7);
        
        var culobpr = (parseInt(nobpr)*10000*0.3);
        
        //=== TODO === 30만 / 50만 중복 체크 안되야함.
        //=== TODO === 세이브포인트 체크 해제시 가격 변동 필요
            if($('input:radio[id="saleN"]').is(':checked') == true && nobpr != "0"){
                //INSERT
                $("#dcntNm").val(obnm);
                $("#dcntAmt").val(obpr);
                $("#cuEtcPrice").val(culobpr);
                //VIEW
                var txtCm = $("#dcntNm").val() + "  " + $("#dcntsNm").val();
                var txtCp = parseInt($("#dcntAmt").val()) + parseInt($("#dcntsAmt").val());
                
                $("#txtCarsalenm").html(txtCm);
                $("#txtCarsaleprice").html( fnNumberFormat(txtCp) );
                
                $("#tempSalePrice").val(txtCp);
                $("#txtTotalPrice").html("");
                var temp = parseInt( $("#tempPrice").val() ) + parseInt( $("#tempTrColorPrice").val() ) + parseInt( $("#tempInColorPrice").val() ) + parseInt( $("#tempTmPrice").val() ) + parseInt( $("#tempOptPrice").val() ) + parseInt( $("#tempTuixPrice").val() ) ;
                $("#txtTotalPrice").html( fnNumberFormat( parseInt( temp ) - (parseInt( txtCp )) ) );     
                
            }else{
                
                $("#dcntNm").val("");
                $("#dcntAmt").val("0");
                $("#cuEtcPrice").val("0");
                
                $("#txtCarsalenm").html("");
                $("#txtCarsaleprice").html("");
                //VIEW
                var txtCm = $("#dcntsNm").val();
                var txtCp = parseInt($("#dcntsAmt").val());
                
                $("#txtCarsalenm").html(txtCm);
                $("#txtCarsaleprice").html( fnNumberFormat(txtCp) );

                $("#tempSalePrice").val(txtCp);
                $("#txtTotalPrice").html("");
                var temp = parseInt( $("#tempPrice").val() ) + parseInt( $("#tempTrColorPrice").val() ) + parseInt( $("#tempInColorPrice").val() ) + parseInt( $("#tempTmPrice").val() ) + parseInt( $("#tempOptPrice").val() ) + parseInt( $("#tempTuixPrice").val() );
                $("#txtTotalPrice").html( fnNumberFormat( parseInt( temp ) - (parseInt( txtCp )*0.7) ) );    
            }
        
    }
    //판매조건 처리 - 기본조건
    function saleOpens( obnm, obpr ){
        //dcntsNm / dcntsAmt
        var obnm = obnm;
        var obpr = (parseInt(obpr)*10000);
        
        if($('input:checkbox[id="saleA"]').is(':checked') == true){
            //INSERT
            $("#dcntsNm").val(obnm);
            $("#dcntsAmt").val(obpr);
            //VIEW        
            var txtCm = $("#dcntNm").val() + "   " + $("#dcntsNm").val();
            var txtCp = parseInt($("#dcntAmt").val()) + parseInt($("#dcntsAmt").val());
            
            $("#txtCarsalenm").html(txtCm);
            $("#txtCarsaleprice").html( fnNumberFormat(txtCp) );
            
            $("#tempSalePrice").val(txtCp);
            $("#txtTotalPrice").html("");
            var temp = parseInt( $("#tempPrice").val() ) + parseInt( $("#tempTrColorPrice").val() ) + parseInt( $("#tempInColorPrice").val() ) + parseInt( $("#tempTmPrice").val() ) + parseInt( $("#tempOptPrice").val() ) + parseInt( $("#tempTuixPrice").val() );
            $("#txtTotalPrice").html( fnNumberFormat( parseInt( temp ) - parseInt( txtCp ) ) );  
            
        }else{
            
            $("#dcntsNm").val("");
            $("#dcntsAmt").val("0");
            
            $("#txtCarsalenm").html("");
            $("#txtCarsaleprice").html("");
            
            var txtCm = $("#dcntNm").val() ;
            var txtCp = parseInt($("#dcntAmt").val()) ;
            
            $("#txtCarsalenm").html(txtCm);
            $("#txtCarsaleprice").html( fnNumberFormat(txtCp) );
            
            $("#tempSalePrice").val(txtCp);
            $("#txtTotalPrice").html("");
            var temp = parseInt( $("#tempPrice").val() ) + parseInt( $("#tempTrColorPrice").val() ) + parseInt( $("#tempInColorPrice").val() ) + parseInt( $("#tempTmPrice").val() ) + parseInt( $("#tempOptPrice").val() ) + parseInt( $("#tempTuixPrice").val() );
            $("#txtTotalPrice").html( fnNumberFormat( parseInt( temp ) - parseInt( txtCp ) ) );              
            
        }
    }
    
    //지불방법( ajax X )
    
    
    //탁송지 2차 리스트
    function selectTSAlist(obj){
        
        var wdrgCd = obj; 
        $('#wdrgCd').val( wdrgCd );
        
        $.ajax({
            type:'POST',
            url:'selectZoneList.do' ,
            data:{
                'wdrgCd':wdrgCd
            },
            dataType:'html',
            cache:false,
            error:function(){
               alert("데이터를 가져오지 못하였습니다."); 
            },
            success:function ( html, status ){
                $('#ctszoneListArea').html(html);
                selectTSAs("시/도 선택");
            }
        });
    }
    
    function selectTSAs( obj ){
        var regnCd = obj;
        var cntrCd = $('#cntrCd').val();
        var wdrgCd = $('#wdrgCd').val();
        var vehlMdlCd = $('#vehlMdlCd').val();
        var param = 'wdrgCd=' + wdrgCd +'&regnCd='+ regnCd +'&cntrCd='+ cntrCd +'&vehlMdlCd='+ vehlMdlCd;
        
        $("#wdrgNm").val( $('#ctsList option:selected').text() );
        $("#regnNm").val( $('#ctszoneList option:selected').text() );
       
        $("#txtCarctrnm").html( $("#regnNm").val() );
        
        var cnsgFee = "";
        $('#cnsgFee').val("");
        $.post("selectZoneSlt.do",
            param,
            function(data){
                var sltList = [];
                var items = $(data).find("item");
                var ite = items.size();
                items.each(function(index,element){
                    var object={};
                    var selfFee = $(this).find("value").eq(0).text();
                    var cnsgFee = $(this).find("value").eq(1).text();
                    object["code"] = selfFee;
                    object["name"] = cnsgFee;
                    sltList[index] = object;
                });
                if(sltList.length >= 0){
                    for ( var i = 0 ; i < sltList.length ; i++ ){
                        cnsgFee = sltList[i]["code"];
                        $('#cnsgFee').val(cnsgFee);
                    }
                }else{
                    cnsgFee = 0;
                    $('#cnsgFee').val(cnsgFee);
                }                    

                $("#txtCnsgprice").html( fnNumberFormat( $('#cnsgFee').val() ) );
                
                $("#tempCnsgFeePrice").val($('#cnsgFee').val());
                $("#txtTotalPrice").html("");
                var temp = parseInt( $("#tempPrice").val() ) + parseInt( $("#tempTrColorPrice").val() ) + parseInt( $("#tempInColorPrice").val() ) + parseInt( $("#tempTmPrice").val() ) + parseInt( $("#tempOptPrice").val() ) + parseInt( $("#tempTuixPrice").val() ) - parseInt( $("#tempSalePrice").val() );
                
                if(cnsgFee == "") {
                    $('#cnsgFee').val("0");
                }  
                
                $("#txtTotalPrice").html( fnNumberFormat( parseInt( temp ) + parseInt( $("#cnsgFee ").val() ) ) );  
                
                if(cnsgFee == "") {
                    $('#cnsgFee').val("");
                    $('#txtCarctrnm').html("");
                } 
                
            }
        );
                       
    }
    
    //등록지역
    function selectReg(){
        $.post("selectRegisterList.do",
            {
            },
            function(data){
                var rgList = [];
                var items = $(data).find("item");
                var ite = items.size();
                items.each(function(index,element){
                    var object={};
                    var rg = $(this).find("value").eq(0).text();
                    var rgN = $(this).find("value").eq(1).text();
                    object["code"] = rg;
                    object["name"] = rgN;
                    rgList[index] = object;
                });
                if(rgList.length > 0){
                    $('#rgArea').find("option").remove();
                    $('#rgArea').append('<option value="">시/도</option>');
                    for ( var i = 0 ; i < rgList.length ; i++ ){
                        $('#rgArea').append('<option value="'+rgList[i]["code"]+'" >'+rgList[i]["name"]+'</option>');
                    }
                }else{
                    $('#rgArea').find("option").remove();
                    $('#rgArea').append('<option value="">시/도</option>');
                }
            }
        );
    }
    
    function PreInsert(){

        var frm = document.insertForm;
        
        var paycheck = 0;
        for ( var i = 0 ; i < frm.pay.length ; i++ ){
            if ( frm.pay[i].checked == true ){
                    paycheck = paycheck + 1;
            }
        }
        
        if ( paycheck < 1 ){
            alert( "할부 유형을 선택해 주세요." );
            return;
        }
        
        if ( frm.cnsgFee.value == "" ){
            alert( "탁송지를 선택해 주세요." );
            return;
        }
        
        var gongcheck = 0;
        for ( var i = 0 ; i < frm.gc.length ; i++ ){
            if ( frm.gc[i].checked == true ){
                gongcheck = gongcheck + 1;
            }
        }
        if ( gongcheck < 1 ){
            alert( "공채 유형을 선택해 주세요." );
            return;
        }
        
        var param = $('form[name="insertForm"]').serialize();
        
        $.ajax({
            type:'POST',
            url:'estimationcomplete.do',
            data:param,
            dataType:'html',
            cache:false,
            success:function ( html, status ){
                $('#submitContents').html(html);
                var Timer = setTimeout("InsertValue()", 2000);
            }
        });  
        
    }

    function InsertValue(){
    
        var qua = $('#quotno').val();        
        var frm = document.insertForm;
        
        var paycheck = 0;
        for ( var i = 0 ; i < frm.pay.length ; i++ ){
            if ( frm.pay[i].checked == true ){
                    paycheck = paycheck + 1;
            }
        }
        
        if ( paycheck < 1 ){
            alert( "할부 유형을 선택해 주세요." );
            return;
        }
        
        if ( frm.cnsgFee.value == "" ){
            alert( "탁송지를 선택해 주세요." );
            return;
        }
        
        var gongcheck = 0;
        for ( var i = 0 ; i < frm.gc.length ; i++ ){
            if ( frm.gc[i].checked == true ){
                gongcheck = gongcheck + 1;
            }
        }
        if ( gongcheck < 1 ){
            alert( "공채 유형을 선택해 주세요." );
            return;
        }

        frm.action = "estimationcompleteview.do";
        frm.submit();
    }
    
    function fnHbMonthChk(obj){

    }
    
    function fnOnlyNumber(loc) {
        if(/[^0123456789]/g.test(loc.value)) {
            alert("0-9의 정수만 입력하세요.");
            loc.value = "";
            loc.focus();
        }
    }
    
    function fnPriceOverChk(obj, type){
        if(type == "hbwg"){
            if(obj.value * 10000 > $("#basicPrice").val()){
                alert("할부 금액은 "+ fnNumberFormat($("#basicPrice").val()) +"원을 초과할 수 없습니다.");
                $('#hb_wn').focus();
                $('#hb_wn').val("");
                return;
            }   
        }else if(type == "mPoint"){
            if(parseInt(obj.value * 10000) + parseInt($('#dcntAmt').val()) >= 2000000){
                alert("'세이브포인트+카드포인트'는 200만원을 초과할 수 없습니다.");
                $('#mPoint').focus();
                $('#mPoint').val("");
                return;
            }  
        }
    }
    
    function fnNumberFormat(input){
        var input = String(input);
        var reg = /(\-?\d+)(\d{3})($|\.\d+)/;
        if(reg.test(input)){
            return input.replace(reg, function(str, p1, p2, p3){
                return fnNumberFormat(p1) + "," + p2 + "" + p3;
            });
        }else{
            return input;
        }
    }
    
    function fnNumberFormatPrint(input, area){
        var input = String(input);
        var reg = /(\-?\d+)(\d{3})($|\.\d+)/;
        if(reg.test(input)){
            return input.replace(reg, function(str, p1, p2, p3){
                $(area).html( fnNumberFormat(p1) + "," + p2 + "" + p3 );
            });
        }else{
            $(area).html( input );
        }
    }
    
    function fnPayTypeChk(ov){
        
        var ov = ov;
        
        if ( ov == "C" ){
            $('.select-box select-type1').css("display", "none");
            $('#hb_wn').val("0");
            $('#hb_wn').attr("readonly", "readonly");
        }else if( ov == "B" ){
            $('#hb_cd').attr("class", "select1 select-type1");
            $('#hb_wn').attr("class", "txt");
            $('#hb_wn').attr("readonly", false);
        }
    }

    //-----
    
    var T;
    function fnNumForm(xVal, yVal, type){
        T = Number('1e' + 1);
        var result;

        if(type == "*"){
            result = Math.round((parseFloat( xVal ) * parseFloat( yVal )) * T) / T;
        }
        if(type == "/"){
            result = Math.round((parseFloat( xVal ) / parseFloat( yVal )) * T) / T;
        }
        if(type == "+"){
            result = Math.round((parseFloat( xVal ) + parseFloat( yVal )) * T) / T;
        }
        if(type == "-"){
            result = Math.round((parseFloat( xVal ) - parseFloat( yVal )) * T) / T;
        }
        return result;
    }
    
    /*
    function fnNumberFormat(input){
        var input = String(input);
        var reg = /(\-?\d+)(\d{3})($|\.\d+)/;
        if(reg.test(input)){
            return input.replace(reg, function(str, p1, p2, p3){
                return fnNumberFormat(p1) + "," + p2 + "" + p3;
            });
        }else{
            return input;
        }
    }
    */
    
    /**************************************
    A * r * (1 + r)^n / ((1 + r)^n - 1)
    ***************************************/
//  A : 원금총액
//  r : 할부이율
//  n : 할부개월
    
    function fnIstmIntMonth(a, n){
    //a : 원금총액 = hb_won_price
    //r : 할부이율 = hb_int_pro_month
    //n : 할부개월 = hb_month
        if(n >= "12" || n < "60"){
            r = 7.95 / 100 / 12;
        }else{
            r = 8.6 / 100 / 12;
        }
        var fst = Math.pow((1 + r), n);
        var sec = a * r * (fst) / ((fst) - 1);
        var fnh = Math.round(sec);
        var result = fnNumberFormat(fnh);
        $("#monthlypay").val( fnh );
        return result;
    }

    function fnIstmIntMonthTot(a, n){
        if(n >= "12" || n < "60"){
            r = 7.95 / 100 / 12;
        }else{
            r = 8.6 / 100 / 12;
        }
        var fst = Math.pow((1 + r), n);
        var sec = a * r * (fst) / ((fst) - 1);
        var fnh = Math.round(sec);
        
        hb_tot_price = (fnh * n) - a;
        var result = fnNumberFormat(hb_tot_price);
        //hb_tot_price
        $("#interest").val(hb_tot_price);
        return result;
    }
    
    function varlogin(){
        
        if ( $('#userid').val() != "" ) {
            ask.layerpopupControl($('.ssl_layer_control'));
        }else{
            var param = "cate=ON";
            $.ajax({
                type:'POST',
                url:'estimationlogin.do',
                data:param,
                dataType:'html',
                cache:false,
                error:function(){
                   alert("팝업의 데이터를 가져오지 못하였습니다.1"); 
                },
                success:function ( html, status ){
                    $('#popContents').html(html);
                    fnInsertPopup('#popContents');
                }
            });    
        }
    }
    
    function fnInsertPopup(area){
        $(area).height('');
        $('body').dimmedFrame();
        $('.dimmed-frame').css({height:$("#wrap").height()});
        $(area).css("display", "");
        $(area).css({top:$(window).scrollTop()+550}).show();
        $('#mbrEml').focus();
        
    }
    
    function closeLayer(area){
        $('.dimmed-frame').remove();
        $(area).html("");
        $('#popContents').html("");
        $(area).hide(); 
    }
    
    function reloadArea( _obj, _oa, _ob ){
        $('.dimmed-frame').remove();
        $('#popContents').hide();
        $('#popContents').html("");
                
        var param = "";
        
        $.ajax({
            type:'POST',
            url:'estimation_sns.do',
            data:param,
            dataType:'html',
            cache:false,
            error:function(){
               //alert("팝업의 데이터를 가져오지 못하였습니다.2"); 
            },
            success:function ( html, status ){
                ask.setUser(html);
                ask.layerpopupControl($('.ssl_layer_control'));
            }
        });    
    }
    
    /*
    //긴급안내팝업_20130102 Ktkim
    function setCookie(strName, strValue) {
        var objExpireDate = new Date();

        objExpireDate.setDate(objExpireDate.getDate() + (24 * 60 * 60 * 1000)); 
        
        document.cookie = strName + "=" + escape(strValue) + "; path=/; expires=" + objExpireDate.toGMTString() + ";";

        //alert(document.cookie);
      }

      function delCookie(strName) {
        var objExpireDate = new Date();

        objExpireDate.setDate(objExpireDate.getDate() - 1);
        
        document.cookie = strName + "=;expires=" + objExpireDate.toGMTString();
      }

      function getCookie(strName) {
        var strCookieName = strName + "=";
        var objCookie = document.cookie;
        
        if (objCookie.length > 0){
            var nBegin = objCookie.indexOf(strCookieName);
            
            if (nBegin < 0){
                return false;
            }

            nBegin += strCookieName.length;
            
            var nEnd = objCookie.indexOf(";", nBegin);
            
            if (nEnd == -1){
                nEnd = objCookie.length;
            }
        }
        //alert(objCookie.substring(nBegin, nEnd));
        
        return unescape(objCookie.substring(nBegin, nEnd));
      }

      function layerClose2(idx){
          setCookie("HMC"+idx, "HMC"+idx+"_cookie");
          $("#pop"+idx).hide();
      } 

      function layerClose(idx){
          if($("input[name=popCheck"+idx+"]:checked").size() > 1){
            // setCookie("HMC"+idx, "HMC"+idx+"_cookie");
          }
          $("#pop"+idx).hide();
      }
*/

//-->
</script>

</head>
<body>
<%-- <%@ include file="/WEB-INF/jsp/com/include/layerpopup.jspf" %> --%>
<div id="wrap" class="non-subnavigation">
    <%@ include file="/WEB-INF/jsp/com/include/navi_utill_sub.jspf" %>
    <%@ include file="/WEB-INF/jsp/com/include/navi_header.jspf" %>
    <hr />

    <%@ include file="/WEB-INF/jsp/com/include/sub_header_estimation01.jspf" %>
    <hr />

    <div id="container">
        <div id="subtitle-area"><div class="subtitle-area-inner">
            <%@ include file="/WEB-INF/jsp/com/include/location.jspf" %>
        </div></div>
        <div id="article">
        <form name="insertForm" id="insertForm" method="post" action="" >
            <input type="hidden" name="quotno" id="quotno" value="<c:out value="${estComVO.quotno}"/>" />
            <input type="hidden" name="carcode" id="carcode" value="<c:out value="${estComVO.carcode }"/>" /> <!-- 차량코드 -->
            <input type="hidden" name="userid" id="userid" value="<c:out value="${fnc:encryptCb(userInfo.mbrSn) }"/>" />
            <input type="hidden" name="vehlMdlCd" id="vehlMdlCd" value="" /> <!--판매코드 --> 
            <input type="hidden" name="carname" id="carname" value="" /> <!-- 차량명 -->
            <input type="hidden" name="opcode" id="opcode" value="" />
            <input type="hidden" name="gradecode" id="gradecode" value="" /> <!-- 등급코드 -->
            <input type="hidden" name="gradename" id="gradename" value="" /> <!-- 등급명 -->
            <input type="hidden" name="gradeDcode" id="gradeDcode" value="" /> <!-- 상세코드 -->
            <input type="hidden" name="gradeDname" id="gradeDname" value="" /> <!-- 상세명 -->
            <input type="hidden" name="trimcode" id="trimcode" value="" /> <!-- 트림코드 -->
            <input type="hidden" name="setCd" id="setCd" value="" /> <!-- 셋코드 -->
            <input type="hidden" name="basicPrice" id="basicPrice" value="" /> <!-- 기본가격 -->
            <input type="hidden" name="nTcolorname" id="nTcolorname" value="" /> <!-- 외장칼라명 -->
            <input type="hidden" name="nTcolorprice" id="nTcolorprice" value="" /> <!-- 외장칼라가격 -->
            <input type="hidden" name="nTcolorcode" id="nTcolorcode" value="" /> <!-- 외장칼라코드 -->
            <input type="hidden" name="nIcolorname" id="nIcolorname" value="" /> <!-- 내장칼라명 -->
            <input type="hidden" name="nIcolorprice" id="nIcolorprice" value="" /> <!-- 내장칼라가격 -->
            <input type="hidden" name="nIcolorcode" id="nIcolorcode" value="" /> <!-- 내장칼라코드 -->
            <input type="hidden" name="tmcode" id="tmcode" value="" /> <!-- 미션코드 -->
            <input type="hidden" name="tmprice" id="tmprice" value="" /> <!-- 미션가격 -->
            <input type="hidden" name="ver" id="ver" value="" /> <!-- 버전 -->
            <input type="hidden" name="optnCd" id="optnCd" value="" /> <!-- 옵션코드 -->
            <input type="hidden" name="optnItemNm" id="optnItemNm" value="" /> <!-- 옵션명 -->
            <input type="hidden" name="optPrice" id="optPrice" value="" /> <!-- 옵션가격 -->
            <input type="hidden" name="partsCd" id="partsCd" value="" /> <!-- 파츠코드 -->
            <input type="hidden" name="partsNm" id="partsNm" value="" /> <!-- 파츠명 -->
            <input type="hidden" name="partsprice" id="partsprice" value="" /> <!-- 파츠가격 -->
            
            <input type="hidden" name="dcntsNm" id="dcntsNm" value="" /> <!-- 판매조건명 (기본조건)-->
            <input type="hidden" name="dcntsAmt" id="dcntsAmt" value="0" /> <!-- 판매조건가격 -->
            <input type="hidden" name="dcntNm" id="dcntNm" value="" /> <!-- 판매조건명 (세이브포인트)-->
            <input type="hidden" name="dcntAmt" id="dcntAmt" value="0" /> <!-- 판매조건가격 -->

            <input type="hidden" name="cntrCd" id="cntrCd" value="" /> <!-- 출고지코드 -->
            <input type="hidden" name="wdrgCd" id="wdrgCd" value="" /> <!-- 지역코드 -->
            <input type="hidden" name="regnCd" id="regnCd" value="" /> <!-- 하위지역코드 -->
            <input type="hidden" name="wdrgNm" id="wdrgNm" value="" /> <!-- 하위지역코드 -->
            <input type="hidden" name="regnNm" id="regnNm" value="" /> <!-- 하위지역코드 -->
            <input type="hidden" name="cnsgFee" id="cnsgFee" value="" /> <!-- 탁송비 -->
            
            <input type="hidden" name="imagepath" id="imagepath" value="" /> <!--  -->
            
            <input type="hidden" name="tempPrice" id="tempPrice" value="0" />
            <input type="hidden" name="tempGradePrice" id="tempGradePrice" value="0" />
            <input type="hidden" name="tempTrimPrice" id="tempTrimPrice" value="0" />
            <input type="hidden" name="tempTrColorPrice" id="tempTrColorPrice" value="0" />
            <input type="hidden" name="tempInColorPrice" id="tempInColorPrice" value="0" />
            <input type="hidden" name="tempTmPrice" id="tempTmPrice" value="0" />
            <input type="hidden" name="tempOptPrice" id="tempOptPrice" value="0" />
            <input type="hidden" name="tempTuixPrice" id="tempTuixPrice" value="0" />
            <input type="hidden" name="tempSalePrice" id="tempSalePrice" value="0" />
            <input type="hidden" name="tempCnsgFeePrice" id="tempCnsgFeePrice" value="0" />
            <input type="hidden" name="cuEtcPrice" id="cuEtcPrice" value="0" />
            <input type="hidden" name="partYn" id="partYn" value="N" />            

            <input type="hidden" id="car_name" name="car_name" value="" />
            <input type="hidden" id="car_name_eng" name="car_name_eng" value="" />
            <input type="hidden" id="car_code" name="car_code" value="" />
            <!-- SNML 환경변수 -->
            <div id="snml" style="display:none">
              <div class="snml_comment">견적내기</div>
              <div class="snml_title">견적내기</div>
              <div class="snml_URL">http://www.hyundai.com</div>
              <div class="snml_img">http://www.hyundai.com/img/img.gif</div>
              <div class="snml_caption">견적내기caption</div>
              <div class="snml_description">견적내기</div>
            </div>
                
            <div class="estimation-wrap">
                <!-- 견적 선택 값 뿌리기 -->
                <div class="total-thumb">
                    <div class="car-name">
                        <span id="txtCarName"></span>
                        <em><span id="txtGrade"></span> <span id="txtGradeDetail"></span></em>
                    </div>
                    <div class="user-section">
                        <div class="friend" id="snsview">
                            <script type="text/javascript" charset="utf-8" src="${snsHttpDomain }/sns/poll?type=6&pageCode=estimationgeneral&js=1&uKey=<c:out value="${fnc:encryptCb(userInfo.mbrSn) }"/>"></script>
                            <a href="#ssl_friend_layerpopup" class="ssl_layer_control"><img src="${snsHttpDomain }/_html/hmc/images/estimation/txt_friend.gif" alt="친구에게 묻기" onClick="varlogin();" /></a>
                        </div>
                        <div class="favorite">
                            <script type="text/javascript" charset="utf-8" src="${snsHttpDomain }/sns/pub?type=4&pageCode=estimationgeneral&js=1&uKey=<c:out value="${fnc:encryptCb(userInfo.mbrSn) }"/>"></script>
                        </div>
                    </div>
                    <img src="" alt="선택 차량 이미지" class="car-thumb" id="selectCarImg" />
                    <dl class="selected-stats">
                        <dt>
                            <img src="/kr/images/estimation/txt_estimation01_01.gif" alt="총 금액" />
                            <span class="price"><span id="txtTotalPrice"></span><em>원</em></span>
                        </dt>
                        <dd>
                            <ul>
                                <li id="m1" class="on">
                                    <span class="option c-price"><em>차량기본가격</em></span>
                                    <p class="s-stats"><span id="txtCarfnm"></span></p>
                                    <p class="price"><span id="txtCarbasicprice"></span>원</p>
                                </li>
                                <li id="m2">
                                    <span class="option c-color"><em>색상</em></span>
                                    <p class="s-stats"><span id="txtCarclrnm"></span></p>
                                    <p class="price"><span id="txtCarclrprice"></span>원</p>
                                </li>
                                <li id="m3">
                                    <span class="option c-option"><em>옵션</em></span>
                                    <p class="s-stats"><span id="txtCaroptnm"></span></p>
                                    <p class="price"><span id="txtCaroptprice"></span>원</p>
                                </li>
                                <li id="m4">
                                    <span class="option c-purpose"><em>구매조건</em></span>
                                    <p class="s-stats"><span id="txtCarsalenm"></span></p>
                                    <p class="price"><span id="txtCarsaleprice"></span>원</p>
                                </li>
                                <li id="m5">
                                    <span class="option c-deliver"><em>탁송료</em></span>
                                    <p class="s-stats"><span id="txtCarctrnm"></span></p>
                                    <p class="price"><span id="txtCnsgprice"></span>원</p>
                                </li>
                            </ul>
                        </dd>
                    </dl>
                </div>
                <!-- 견적 선택 값 뿌리기 -->

                <div class="estimation-step">
                    <div class="step-wrap">
                        <div class="step-tit">
                            <em class="item"><img src="/kr/images/estimation/txt_s_step01.gif" alt="01. 차종선택" /></em>
                        </div>
                        <div class="step-cont">
                            <div id="carArea" class="car-tab-wrap">
                                <ul class="car-tab">
                                    <li><a href="#" onclick="openCar('RD');">승용</a></li>
                                    <li><a href="#" onclick="openCar('RV');">RV</a></li>
                                    <li><a href="#" onclick="openCar('CU');">소형상용</a></li>
                                    <li><a href="#" onclick="openCar('TX');">택시</a></li>
                                    <li><a href="#" onclick="openCar('HD');">장애인</a></li>
                                    <li><a href="#" onclick="openCar('RN');">렌터카</a></li>
                                </ul>
                                <div class="car-tab-cont">
                                    <span id="RD"></span>
                                </div>
                                <div class="car-tab-cont">
                                    <span id="RV"></span>
                                </div>
                                <div class="car-tab-cont">
                                    <span id="CU"></span>
                                </div>
                                <div class="car-tab-cont">
                                    <span id="TX"></span>
                                </div>
                                <div class="car-tab-cont">
                                    <span id="HD"></span>
                                </div>
                                <div class="car-tab-cont">
                                    <span id="RN"></span>
                                </div>
                            </div>
                            <!--  -->
                            <div class="car-detail-select">
                                <table class="detail-option-list" summary="등급선택, 상세차종선택">
                                <caption>선택차종 상세선택</caption>
                                <colgroup>
                                    <col width="30%" />
                                    <col width="70%" />
                                </colgroup>
                                <thead>
                                <tr>
                                    <th scope="col"><img src="/kr/images/estimation/txt_estimation01_08.gif" alt="등급선택" /></th>
                                    <th scope="col"><img src="/kr/images/estimation/txt_estimation01_09.gif" alt="상세차종선택" /></th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr>
                                    <td id="Grade">
                                        <!-- 등급선택 -->
                                        
                                    </td>
                                    <td id="DGrade">
                                        <!-- 상세등급선택 -->

                                    </td>
                                </tr>
                                </tbody>
                                </table>
                            </div>
                        </div>
                        <img src="/kr/images/common/button/btn_step_next.gif" class="btn-next" alt="다음" id="step1" />
                    </div>
                    <div class="step-wrap">
                        <div class="step-tit">
                            <em class="item"><img src="/kr/images/estimation/txt_s_step02.gif" alt="02. 색상선택" /></em>
                        </div>
                        <div class="step-cont">
                            <div class="car-detail-select subsection0">
                                <div class="one-row">
                                    <p class="title"><img src="/kr/images/estimation/txt_estimation01_10.gif" alt="외장색상 선택" /></p>
                                    <div class="detail-option">
                                        <div class="color-option">
                                            <span id="TColor"></span>                                            
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="car-detail-select">
                                <div class="one-row">
                                    <p class="title"><img src="/kr/images/estimation/txt_estimation01_11.gif" alt="내장색상 선택" /></p>
                                    <div class="detail-option">
                                        <div class="color-option">
                                            <span id="IColor"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <img src="/kr/images/common/button/btn_step_prev.gif" class="btn-prev" alt="이전"  id="step2" />
                        <img src="/kr/images/common/button/btn_step_next.gif" class="btn-next" alt="다음"  id="step3" />
                    </div>
                    <div class="step-wrap">
                        <div class="step-tit">
                            <em class="item"><img src="/kr/images/estimation/txt_s_step03.gif" alt="03. 옵션선택" /></em>
                        </div>
                        <div class="step-cont">
                            <div class="car-detail-select subsection0">
                                <div class="one-row">
                                    <p class="title"><img src="/kr/images/estimation/txt_estimation01_12.gif" alt="변속기선택" /></p>
                                    <div class="detail-option">
                                        <div class="half-section-cont-wrap">
                                            <span id="tmIn"></span>
                                            <!-- 변속기 -->
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="car-detail-select">
                                <div class="one-row">
                                    <p class="title"><img src="/kr/images/estimation/txt_estimation01_13.gif" alt="옵션선택" /></p>
                                    <div class="detail-option">
                                        <div class="half-section-cont-wrap">
                                            <span id="optionIn"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div id="Tarea" class="car-detail-select">
                                <div class="one-row">
                                    <p class="title"><img src="/kr/images/estimation/txt_estimation01_14.gif" alt="TUIX 선택" /></p>
                                    <div class="detail-option">
                                        <div class="half-section-cont-wrap">
                                            <span id="TuixArea"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <img src="/kr/images/common/button/btn_step_prev.gif" class="btn-prev" alt="이전"  id="step4" />
                        <img src="/kr/images/common/button/btn_step_next.gif" class="btn-next" alt="다음"  id="step5" />
                    </div>
                    <div class="step-wrap">
                        <div class="step-tit">
                            <em class="item"><img src="/kr/images/estimation/txt_s_step04.gif" alt="04. 구매방법선택" /></em>
                        </div>
                        <div class="step-cont" style="padding-bottom:0px;">
                        
                            <div id="HanDiCap" style="display:none;" class="disabled-class-wrap">
                                <div class="disabled-class">
                                    <p class="title"><img src="/kr/images/estimation/txt_estimation01_15.gif" alt="장애등급" /></p>
                                    <div class="disabled-select">
                                        <label><input type="radio" class="check" name="hicvalue" id="hicvalue" value="A" checked="checked" /> 일반장애(시각장애) 1~3급</label>
                                        <label><input type="radio" class="check" name="hicvalue" id="hicvalue" value="B" /> 국가유공장애 1~7급</label>
                                        <label><input type="radio" class="check" name="hicvalue" id="hicvalue" value="C" /> 시각장애 4급</label>
                                        <label><input type="radio" class="check" name="hicvalue" id="hicvalue" value="D" /> 일반장애 4~6급</label>
                                    </div>
                                </div>
                                <div class="datatable-wrap">
                                    <table summary="구분, 시각장애 4급(특별 소비세), 차량등록시(지방세(등록세,취득세),공채급약), 차량구입시(자동차세)">
                                    <caption>장애등급 산정표</caption>
                                    <colgroup>
                                        <col />
                                        <col />
                                        <col width="20%" />
                                        <col width="20%" />
                                        <col />
                                    </colgroup>
                                    <thead>
                                    <tr>
                                        <th scope="col" rowspan="2"><img src="/kr/images/estimation/txt_estimation01_20.gif" alt="구분" /></th>
                                        <th scope="col"><img src="/kr/images/estimation/txt_estimation01_23.gif" alt="차량구입시" /></th>
                                        <th scope="col" colspan="2"><img src="/kr/images/estimation/txt_estimation01_22.gif" alt="차량등록시" /></th>
                                        <th scope="col"><img src="/kr/images/estimation/txt_estimation01_23.gif" alt="차량구입시" /></th>
                                    </tr>
                                    <tr>
                                        <th scope="col"><img src="/kr/images/estimation/txt_estimation01_24.gif" alt="특별소비세" /></th>
                                        <th scope="col"><img src="/kr/images/estimation/txt_estimation01_25.gif" alt="지방세(등록세, 취득세)" /></th>
                                        <th scope="col"><img src="/kr/images/estimation/txt_estimation01_26.gif" alt="공채금액" /></th>
                                        <th scope="col"><img src="/kr/images/estimation/txt_estimation01_27.gif" alt="자동차세" /></th>
                                    </tr>
                                    </thead>
                                    <tbody id="TAX01" style="display:none;">
                                    <tr>
                                        <td class="bg01">일반장애(시각장애) 1~3급</td>
                                        <td>면제</td>
                                        <td>면제</td>
                                        <td>면제</td>
                                        <td class="last">면제</td>
                                    </tr>
                                    <tr>
                                        <td class="bg01">국가유공장애 1~7급</td>
                                        <td>면제</td>
                                        <td>면제</td>
                                        <td>면제</td>
                                        <td class="last">면제</td>
                                    </tr>
                                    <tr>
                                        <td class="bg01">시각장애 4급</td>
                                        <td>-</td>
                                        <td>면제</td>
                                        <td>면제</td>
                                        <td class="last">면제</td>
                                    </tr>
                                    <tr>
                                        <td class="bg01">일반장애 4~6급</td>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>면제</td>
                                        <td class="last">-</td>
                                    </tr>
                                    </tbody>
                                    
                                    <tbody id="TAX02" style="display:none;">
                                    <tr>
                                        <td class="bg01">일반장애(시각장애) 1~3급</td>
                                        <td>면제</td>
                                        <td>-</td>
                                        <td>면제</td>
                                        <td class="last">-</td>
                                    </tr>
                                    <tr class="">
                                        <td class="bg01">국가유공장애 1~7급</td>
                                        <td>면제</td>
                                        <td>-</td>
                                        <td>면제</td>
                                        <td class="last">-</td>
                                    </tr>
                                    <tr >
                                        <td class="bg01">시각장애 4급</td>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>면제</td>
                                        <td class="last">-</td>
                                    </tr>
                                    <!-- //130314 수정_01 -->
                                    <tr>
                                        <td class="bg01">일반장애 4~6급</td>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>면제</td>
                                        <td class="last">-</td>
                                    </tr>
                                    </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class="car-detail-select">
                            <table class="detail-option-list" summary="판매조건, 지불방법">
                            <caption>구매방법 상세선택</caption>
                            <thead>
                            <tr>
                                <th scope="col"><img src="/kr/images/estimation/txt_estimation01_16.gif" alt="판매조건" /></th>
                                <th scope="col"><img src="/kr/images/estimation/txt_estimation01_17.gif" alt="지불방법" /></th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr>
                                <td id="saleList">
                                    
                                </td>
                                <td id="culrList">
                                    <ul class="check-list">
                                        <li>
                                            <label><input type="radio" class="check" name="pay" id="pay" value="C" onclick="fnPayTypeChk('C');" checked="checked" /> 현금일시불</label>
                                            <!-- <p class="price">300,000원</p> -->
                                        </li>
                                        <li class="brd-sect" style="display:none">
                                            <label><input type="radio" class="check" name="pay" id="pay" value="B" onclick="fnPayTypeChk('B');" /> 할부구매(오토할부)</label>
                                            <div class="plan-wrap">
                                                할부기간
                                                <!-- 12~48 : 7.95 / 60 : 8.6 -->
                                                <select name="hb_cd" id="hb_cd" class="select select-type1" style="width:130px;" onchange="fnHbMonthChk(this);">
                                                    <option value="12">12개월</option>
                                                    <option value="24">24개월</option>
                                                    <option value="36">36개월</option>
                                                    <option value="48">48개월</option>
                                                    <option value="60">60개월</option>
                                                </select>
                                                <div class="sect">
                                                    할부원금
													<!-- cidow_130411 -->
                                                    <input type="text" class="txt" name="hb_wn" id="hb_wn" style="width:126px;" value="0" onkeyup="fnOnlyNumber(this);fnPriceOverChk(this, 'hbwg');"/>
													<!-- //cidow_130411 -->
                                                    만원
                                                </div>
                                            </div>
                                        </li>
                                    </ul>
                                </td>
                            </tr>
                            </tbody>
                            </table>
                            <div class="point-search">
                                <div>
                                    <b>M포인트</b>
                                    <input type="text" class="txt" name="mPoint" id="mPoint" style="width:76px;" onkeyup="fnOnlyNumber(this);fnPriceOverChk(this, 'mPoint');" />
                                    만원
                                    <a href="http://www.hyundaicard.com/o/index.html" target="_blank"><img src="/kr/images/common/button/btn_point_search.gif" alt="포인트 조회" class="btn" /></a>
                                </div>
                                <div>
                                    <b>블루멤버스<br />포인트</b>
                                    <input type="text" class="txt" name="bPoint" id="bPoint" style="width:76px;" onkeyup="fnOnlyNumber(this);" />
                                    만원
                                    <a href="http://blu.hyundai.com/oc/hpns/pts_itdc/hpns_pts_itdc_pts_itdc.jsp?screenNm=hpns_pts_itdc_pts_itdc"  target="_blank"><img src="/kr/images/common/button/btn_point_search.gif" alt="포인트 조회" class="btn" /></a>
                                </div>
                            </div>
                        </div>
                        <div class="car-detail-select">
                            <table class="detail-option-list" summary="탁송지, 등록비용">
                            <caption>탁송지 및 등록비용 선택</caption>
                            <colgroup>
                                <col width="50%" />
                                <col width="50%" />
                            </colgroup>
                            <thead>
                            <tr>
                                <th scope="col"><img src="/kr/images/estimation/txt_estimation01_18.gif" alt="탁송지" /></th>
                                <th scope="col"><img src="/kr/images/estimation/txt_estimation01_19.gif" alt="등록비용" /></th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr>
                                <td id="ctsListArea">
                                    <div class="deli-regist">
                                        <select class="select1 select-type1" name="ctsList" id="ctsList" style="width:115px;" onchange="javascript:selectTSAlist(this.value);"><!--  class="select select-type1" -->
                                            <option>시/도 선택</option>
                                     <c:forEach var="ctr" items="${ctsList}" varStatus="status">
                                            <option value="<c:out value="${ctr.wdrgCd}"/>"><c:out value="${ctr.wdrgNm}"/></option>
                                     </c:forEach>
                                        </select>
                                        <span id="ctszoneListArea">
                                        <select class="select1 select-type1" name="ctszoneList" id="ctszoneList" style="width:115px;" onchange="javascript:selectTSAs(this.value);"><!-- class="select select-type1"  -->
                                            <option>시/도 선택</option>
                                        </select>
                                        </span>
                                        <p class="tip">
                                            * 출고시 출고센터에 따라 탁송료가 변경될<br />수 있습니다.
                                        </p>
                                    </div>
                                </td>
                                <td id="uprListArea">
                                    <div class="deli-regist">
                                        <div class="regist-form">
                                            <em>등록지</em>
                                            <select class="select1 select-type1" name="rgArea" id="rgArea"  style="width:153px;"><!-- class="select select-type1" -->
                                                <option>시/도 선택</option>
                                     <c:forEach var="rg" items="${rgList}" varStatus="status">
                                                <option value="<c:out value="${rg.cd}"/>"><c:out value="${rg.cdNm}"/></option>
                                     </c:forEach>
                                            </select>
                                        </div>
                                        <div class="regist-form">
                                            <em>납부방식</em>
                                            <label><input type="radio" name="gc" id="gc" value="I" class="check"  /> 매입</label>
                                            <label><input type="radio" name="gc" id="gc" value="D" class="check space"   /> 할인</label>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            </tbody>
                            </table>
                        </div>
                        <img src="/kr/images/common/button/btn_step_prev.gif" class="btn-prev" alt="이전" id="step6" />
                        
                        <a href="javascript:void(0);"><img src="/kr/images/common/button/btn_step_complete.gif" class="btn-complete"  style="margin-top:20px;" id="step7" alt="견적내기 완료" onclick="PreInsert();" /></a>
                    </div>
                </div>
            </div>
            </form>
        </div>
    </div>
    <hr />
    <script>
    appendMETA('WT.ti','차종선택');
    </script>
    <%@ include file="/WEB-INF/jsp/com/include/footer.jspf" %>
    <div id="popContents" style="display:none;"></div>
    <div id="submitContents" style="display:none;"></div>
    